<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>


<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="../resource/vendor/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="../resource/vendor/font-awesome/css/font-awesome.min.css">
    <!-- Fontastic Custom icon font-->
    <link rel="stylesheet" href="../resource/css/fontastic.css">
    <!-- Google fonts - Poppins -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,700">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="../resource/css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="../resource/css/custom.css">
    <!-- Favicon-->
    <link rel="shortcut icon" href="../resource/img/favicon.ico">
    <!-- Tweaks for older IEs--><!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
</head>
<body>
<div class="page">

    <div class="page-content d-flex align-items-stretch">

        <div class="content-inner">

            <!-- Forms Section-->
            <section class="forms">
                <div class="container-fluid">
                    <div class="row">
                        <!-- Form Elements -->
                        <div class="col-lg-12">

                            <div class="card-header d-flex align-items-center">
                                <h2  style="margin-left: 40%" >${questionnaire.questionnairetitle}</h2>
                            </div>
                            <div class="card-body">

                                <div class="form-group row">
                                    <div class="col-sm-4"></div>
                                    <div class="col-sm-8">
                                        <c:forEach  items="${pageInfo.list}" var="question">
                                            ${question}
                                            <form  id="${question.qid}" action="../addAnswer.do" method="post" >
                                                <input type="hidden"name="ownerquestionnaireid"
                                                       value="${question.ownerquestionnaireid}" >
                                                <input type="hidden"name="ownerquestionid"
                                                       value="${question.qid}" >
                                                <c:if test="${question.questiontype == 'wenda'}">
                                                    <div class="ansewrs"  >
                                                            ${question.questioncode}：${question.questionheading}
                                                        <input name="answer" type="text" class="form-control">
                                                    </div>
                                                </c:if>
                                                <c:if test="${question.questiontype == 'danxuan'}">
                                                    ${question.questioncode}： ${question.questionheading}（单选题）
                                                    <div class="ansewrs">
                                                        <c:if test="${!empty question.optiona}">
                                                            <div class="i-checks">
                                                                <input   type="radio" name="options" value="A" class="checkbox-template">
                                                                <label >A： ${question.optiona}</label>
                                                            </div>
                                                        </c:if>

                                                        <c:if test="${!empty question.optionb}">
                                                            <div class="i-checks">
                                                                <input  type="radio" name="options" value="B"  class="checkbox-template">
                                                                <label >B： ${question.optionb}</label>
                                                            </div>
                                                        </c:if>

                                                        <c:if test="${!empty question.optionc}">
                                                            <div class="i-checks">
                                                                <input type="radio" name="options" value="C"   class="checkbox-template">
                                                                <label >C： ${question.optionc}</label>
                                                            </div>
                                                        </c:if>

                                                        <c:if test="${!empty question.optiond}">
                                                            <div class="i-checks">
                                                                <input  type="radio" name="options" value="D"  class="checkbox-template">
                                                                <label >D： ${question.optiond}</label>
                                                            </div>
                                                        </c:if>

                                                    </div>

                                                </c:if>
                                                <c:if test="${question.questiontype == 'duoxuan'}">
                                                    ${question.questioncode}：  ${question.questionheading}（多选题）
                                                    <div class="ansewrs">
                                                        <c:if test="${!empty question.optiona}">
                                                            <div class="i-checks">
                                                                <input   type="checkbox" name="options" value="A" class="checkbox-template">
                                                                <label >A： ${question.optiona}</label>
                                                            </div>
                                                        </c:if>
                                                        <c:if test="${!empty question.optionb}">
                                                            <div class="i-checks">
                                                                <input  type="checkbox" name="options" value="B"  class="checkbox-template">
                                                                <label >B： ${question.optionb}</label>
                                                            </div>
                                                        </c:if>

                                                        <c:if test="${!empty question.optionc}">
                                                            <div class="i-checks">
                                                                <input  type="checkbox" name="options" value="C"   class="checkbox-template">
                                                                <label >C： ${question.optionc}</label>
                                                            </div>
                                                        </c:if>

                                                        <c:if test="${!empty question.optiond}">
                                                            <div class="i-checks">
                                                                <input  type="checkbox" name="options" value="D"  class="checkbox-template">
                                                                <label >D： ${question.optiond}</label>
                                                            </div>
                                                        </c:if>
                                                    </div>
                                                </c:if>

                                            </form>
                                        </c:forEach>
                                        <button style="margin-left: 40% ;width: 60px"
                                                class="btn btn-primary">提交</button>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </section>

        </div>
    </div>
</div>


<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<script type="text/javascript" >
    $(document).ready(function(){
        $("button").click(function(){
            $("form").each(function(){

                for (var i=0;i<=20000;i++){
                }
                $(this).submit()

            });
        });
    });
</script>

<!-- JavaScript files-->
<script src="../resource/vendor/jquery/jquery.min.js"></script>
<script src="../resource/vendor/popper.js/umd/popper.min.js"> </script>
<script src="../resource/vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="../resource/vendor/jquery.cookie/jquery.cookie.js"> </script>
<script src="../resource/vendor/chart.js/Chart.min.js"></script>
<script src="../resource/vendor/jquery-validation/jquery.validate.min.js"></script>
<!-- Main File-->
<script src="../resource/js/front.js"></script>
</body>
</html>